import sort_master
sort_master = reload( sort_master )
class Edge(sort_master.SortMaster):
    
    def __init__( self ):
        super( Edge, self ).__init__()
        self.sortattr = 'theta'
        self.theta = None
        self.mid = None
        self.mid2 = None
        self.bot = None
        self.top = None

class Face(sort_master.SortMaster):
    
    def __init__( self ):
        super( Face, self ).__init__()
        self.sortattr = 'theta'
        self.theta = None
        self.feature = None

class CrossSection(sort_master.SortMaster):
    def __init__( self ):
        super( CrossSection, self ).__init__()
        self.sortattr = 'z'
        self.index = None
        self.z = None
        self.nodes = []
        self.thetas = None
        self.forces = None
        self.displs = None
        self.ploads = []

class Meridian(sort_master.SortMaster):
    def __init__( self ):
        super( Meridian, self ).__init__()
        self.sortattr = 'theta'
        self.index = None
        self.theta = None
        self.nodes = []
        self.displs = None
        self.ploads = []

class Node(sort_master.SortMaster):
    def __init__( self ):
        super( Node, self ).__init__()
        self.sortattr = 'z'
        self.z_index = None
        self.theta_index = None
        self.odb_index = None
        self.meridian = None
        self.cross_section = None
        self.x = None 
        self.y = None 
        self.z = None 
        self.theta = None
        self.pload = None
        self.r = None
        self.dx = {}
        self.dy = {}
        self.dz = {}
        self.dr = {}
        self.fx = {}
        self.fy = {}
        self.fz = {}
        self.obj = None

    def id( self ):
        return self.obj.label

class CutPlane(object):

    def __init__( self ):
        self.theta = None
        self.p1 = None
        self.p2 = None
        self.p3 = None
        self.datum = None
        self.feature = None
        self.part = None
    
    def create( self ):
        self.feature = self.part.DatumPlaneByThreePoints( point1 = self.p1,
                                                          point2 = self.p2,
                                                          point3 = self.p3 )
        tmp = self.part.datums.keys()
        tmp.sort()
        self.datum = self.part.datums[ tmp[-1] ]

    def __getattr__( self, attr ):
        try:
            return getattr( self, attr )
        except:
            return getattr( self.datum, attr )

